package hufs.cskim.media;

import static android.provider.BaseColumns._ID;
import static hufs.cskim.media.Constants.TABLE_NAME;
import static hufs.cskim.media.Constants.TITLE;
import static hufs.cskim.media.Constants.PATH;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

public class PlaylistData extends SQLiteOpenHelper {
	private static final String DATABASE_NAME = "playlist.db";
	private static final int DATABASE_VERSION = 1;
	
	public PlaylistData(Context ctx) {
		super(ctx, DATABASE_NAME, null, DATABASE_VERSION);
	}

	@Override
	public void onCreate(SQLiteDatabase db) {
		db.execSQL("CREATE TABLE " + TABLE_NAME + " (" + _ID
	            + " INTEGER PRIMARY KEY AUTOINCREMENT, " + TITLE
	            + " TEXT NOT NULL," + PATH + " TEXT NOT NULL);");
	}

	@Override
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
		db.execSQL("DROP TABLE IF EXISTS " + TABLE_NAME);
		onCreate(db);
	}
	
}
